package com.redbox.RedboxManagment.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.redbox.RedboxManagment.dao.ICardPayment;
import com.redbox.RedboxManagment.ejb.CardPayment;

@Service
public class CardPaymentService implements ICardPaymentService {
	
	@Autowired(required=true)
	private ICardPayment cardPaymentDao;
	
	@Override
	@Transactional
	public CardPayment retrieveUsingId(int pid) {
		CardPayment cardPayment = cardPaymentDao.findById(pid);
		return cardPayment;
	}

	@Override
	@Transactional
	public CardPayment create(CardPayment pcardPayment) {
		CardPayment cardPayment = cardPaymentDao.persistOnMerge(pcardPayment);
		return cardPayment;
	}

}
